import React from 'react';
// 类组件
class APP extends React.Component {
  render() {
    return (
      <div>
        <Child count={100} name="悟空"></Child>
        <Child obj={{ name: '马云', age: 18 }}></Child>
        <Child list={[1, 2, 3, 4]}></Child>
        <Child fn={() => alert('我是传递子组件的方法')}></Child>
        <Child jsx={<i>1232323</i>}></Child>
      </div>
    );
  }
}

const Child = ({ count, name, obj, list, fn, jsx }) => {
  return (
    <div>
      <h3>{count}</h3>
      <div>{name}</div>
      <div>{JSON.stringify(obj)}</div>
      <div>{list}</div>
      <button onClick={fn}>点击</button>
      <div>{jsx}</div>
    </div>
  );
};

export default APP;
